<?php
    // 批准评论接口

    include_once '../../fn.php';

    $id = $_GET['id'];
    // $id = 1;
    // 构造数据库执行串
    $sql = "update comments SET status = 'approved' WHERE id in ($id) and status = 'held';";//只更新满足这两个条件的数据

    // echo '<pre>';
    // print_r($sql);
    // echo '</pre>';

    $result = my_exec($sql);

    if ($result['state']==200) {
        echo '批准成功';
    }elseif ($result['state']==100) {
        echo '批准失败';
    }
?>